package org.banyan.senior.idempotent.controller;

import org.banyan.senior.idempotent.annotation.AutoDuplicateRequest;
import org.banyan.senior.idempotent.util.RedisTokenUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author metalsbanyan
 * @version 1.0
 * @description: 获取token
 * @date 2023/7/21 11:24
 */
@RestController
@AutoDuplicateRequest
public class RedisTokenController {
    private static final Logger LOGGER = LoggerFactory.getLogger(RedisTokenController.class);


    @GetMapping("/getToken")
    public String getToken(HttpServletRequest httpServletRequest) {
        String token = RedisTokenUtil.getApiToken(httpServletRequest);
        LOGGER.debug(token);
        return token;
    }
}
